<?php

namespace App\Admin\Repositories;

use App\Models\TranslateLanguage as Model;
use Dcat\Admin\Repositories\EloquentRepository;

class TranslateLanguage extends EloquentRepository
{
    /**
     * Model.
     *
     * @var string
     */
    protected $eloquentClass = Model::class;

    public function getAllMap()
    {
        return Model::all()->pluck('name', 'code');
    }

    public function getNameByCode($code)
    {
        $name = \App\Models\TranslateLanguage::query()->where('code', $code)->first();
        return $name['name'];
    }
}
